package com.xbhog.transaction.jdbc;

import com.xbhog.session.TransactionIsolationLevel;
import com.xbhog.transaction.Transaction;
import com.xbhog.transaction.TransactionFactory;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * @author 衣立君
 * @date 2024/03/13 10:44
 **/
public class JdbcTransactionFactory implements TransactionFactory {

    @Override
    public Transaction newTransaction(Connection conn) {
        return new JdbcTransaction(conn);
    }

    @Override
    public Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit) {
        return new JdbcTransaction(dataSource,autoCommit,level);
    }
}